package com.xiao.controller;

import com.xiao.entity.Book;
import com.xiao.repository.BookRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @_PackageName:com.xiao.controller
 * @_ClassName:BookController
 * @_Description:
 * @_Author：笑老二
 * @_data 2020/12/21 13:18
 */
@RestController
public class BookController {
    @Autowired
    BookRepository bookRepository;

    @GetMapping("save")
    public Object save(Integer id,String title){

        Book book = new Book();
        book.setAuthor("吴承恩");
        book.setBookName("西游记");
        book.setId(1);
        bookRepository.save(book);
        return  "OK";
    }

}
